#include <cstdio>
#include <cstring>
using namespace std;

#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>

#define MAX_SIZE 1024
#define SYNC_NOW 1 //立即刷新
#define SYNC_LINE 2 //行缓冲
#define SYNC_FULL 4 //全缓冲

typedef struct _FILE
{
    int _fileno; //fd
    int _flag; //刷新策略
    int _size = 0;
    char _buffer[1024];
}_FILE;

_FILE* _fopen(const char* path, const char* mode);
void _fflush(_FILE* fp);
void _fwrite(const char* ptr, size_t size, _FILE* fp);
void _fread(void* ptr, size_t size, _FILE* fp);
void _fclose(_FILE* fp);